fix(agentic): preserve only unparseable tool arguments - #1951
Merged
Conversation
- Return `provided_arguments` only when a provider tool call could not be parsed and retain the complete raw payload. - Stop echoing already-parsed arguments for validation errors. - Cover both full raw-argument preservation and parsed-validation omission.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
provided_argumentsonly when a provider tool call could not be parsed and retain the complete raw payload.Type and Areas
Type:
Bug fix
Areas:
Rust core, tool contracts
Motivation / Impact
Parsed tool arguments are already available in the preceding assistant tool call, so repeating them in an error result wastes context and can duplicate sensitive input.
For malformed argument JSON, truncating the raw payload can hide the actual parse failure and resemble output truncation. The error path now preserves the complete raw provider payload only when no structured argument representation is available.
Verification
pnpm run fmt:rscargo test -p bitfun-agent-tools --test tool_contracts— 104 passedcargo test -p bitfun-core error_result_ --lib— 2 passedgit diff --checkReviewer Notes
provided_argumentsis emitted only whenToolCall.is_errorandraw_argumentsis present.Checklist